﻿$(document).ready(function () {
    $(".browsefilebutton").click(function () {
        //$(".filebrowse").click();
    });
    $(".filebrowse").change(function () {
        //$("#txtImgFiles").val($(this).attr("value"));
        //document.getElementsByName("txtImgFiles").value = document.getElementsByName("file1").value;
    });
});
var loadsubcatajax = null;
function loaddotpanel() {
    $(".dotpanel p").click(function () {
        var id = $(this).attr("id").replace("SubCat", "").replace("Cat", "");
        history.pushState("", "Upload ảnh", "?cat=" + id);
        var sub = false;
        if ($(this).parents(".dotpanel")[0].id == "SubCatList") {
            sub = true;
        }
        if (!sub) {
            $(".selectedcat").removeClass("selectedcat");
            $("#SubCatList .overview").html("");
            if (loadsubcatajax != null) {
                loadsubcatajax.abort();
                loadsubcatajax = null;
            }
            loadsubcatajax = $.ajax({
                url: "/GetList/SubCategory",
                data: { cat: id },
                type: "POST",
                success: function (data) {
                    $("#SubCatList .overview").html(data);
                    loaddotpanel();
                    Website.run();
                    loadsubajax = null;
                }
            });
        } else {
            $("#SubCatList .selectedcat").removeClass("selectedcat");
        }
        $(this).addClass("selectedcat");
    });
}